import {ref,watchEffect} from 'vue'
import * as todoStorage from '../util/todoStorage'
export default function useTodoList() {
    const todosRef = ref(todoStorage.fetch())
    window.todosRef = todosRef
    watchEffect(()=>{
      todoStorage.save(todosRef.value)
    }) //监控副作用 ,这个依赖数据变化会自动重新运行这个函数
    return {
      todosRef
    }
}